
import { createRouter, createWebHistory } from 'vue-router'


export const menu_router = [
  {
    path: '/',
    name: 'home',
    meta: {
      title: '首页'
    },
    component: () => import('../views/home/index.vue'),
  },
  {
    path: '/set',
    name: 'set',
    meta: {
      title: '设置'
    },
    component: () => import('../views/set/index.vue'),
  },
  {
    path: '/listpage',
    name: 'listpage',
    meta: {
      title: '列表管理'
    },
    children: [
      {
        path: '/list',
        name: 'list',
        meta: {
          title: '列表'
        },
        component: () => import('../views/list/index.vue'),
      },
      {
        path: '/roomlist',
        name: 'roomlist',
        meta: {
          title: '房源列表'
        },
        component: () => import('../views/roomlist/index.vue'),
      },
    ]
  },
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: () => import('../views/layout/index.vue'),
      children:menu_router
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/index.vue'),
    },
    {
      path: '/403',
      name: '403',
      component: () => import('../views/403/index.vue'),
    },
    {
      path: '/404',
      name: '404',
      component: () => import('../views/404/index.vue'),
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/404'
    }
  ],
})

export default router
